//
//  TJHomeCell.m
//  CrossBorderPayment
//
//  Created by hc-101 on 2020/6/9.
//  Copyright © 2020 xtjun. All rights reserved.
//

#import "TJHomeCell.h"


@interface TJHomeCell()

@property (weak, nonatomic) UILabel *availableValueLabel;
@property (weak, nonatomic) UILabel *freezeValueLabel;
@property (weak, nonatomic) UILabel *equivalentValueLabel;
@property (weak, nonatomic) UILabel *currencyNameLabel;
 

@end

@implementation TJHomeCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.layer.shouldRasterize = YES;
        self.layer.rasterizationScale = [UIScreen mainScreen].scale;
        self.layer.drawsAsynchronously = YES;
        
         self.selectionStyle = UITableViewCellSelectionStyleNone;
            
           UILabel *currencyNameLabel = [UILabel lableWithSuperView:self.contentView font:MediumFont(15) color:UIColor_Hex(0x333333) title:@"BTC" textAlignment:NSTextAlignmentLeft];
           [currencyNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
               make.top.offset(12);
               make.left.offset(12);
           }];
           
           
           UILabel *availableLabel = [UILabel lableWithSuperView:self.contentView font:UIFont_Px(14) color:UIColor_Hex(0x666666) title:@"可用".localizedString textAlignment:NSTextAlignmentLeft];
           [availableLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(currencyNameLabel.mas_bottom).offset(14);
                make.left.equalTo(currencyNameLabel);
           }];
           
           /**可用 */
           UILabel *availableValueLabel = [UILabel lableWithSuperView:self.contentView font:UIFont_Px(14) color:UIColor.tj_mainColor title:@"0.00000000" textAlignment:NSTextAlignmentLeft];
           [availableValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
               make.top.equalTo(availableLabel.mas_bottom).offset(4);
               make.left.equalTo(availableLabel);
           }];
        
           UILabel *freezeLabel = [UILabel lableWithSuperView:self.contentView font:UIFont_Px(14) color:UIColor_Hex(0x666666) title:@"冻结".localizedString textAlignment:NSTextAlignmentLeft];
           [freezeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
               make.centerY.equalTo(availableLabel);
               make.centerX.offset(0);
           }];
           
           /**冻结 */
           UILabel *freezeValueLabel = [UILabel lableWithSuperView:self.contentView font:UIFont_Px(14) color:UIColor.tj_mainColor title:@"0.00000000" textAlignment:NSTextAlignmentLeft];
           [freezeValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
               make.centerY.equalTo(availableValueLabel);
               make.centerX.offset(0);
           }];
           
           
           UILabel *equivalentLabel = [UILabel lableWithSuperView:self.contentView font:UIFont_Px(14) color:UIColor_Hex(0x666666) title:@"折合(CNY)".localizedString textAlignment:NSTextAlignmentLeft];
           [equivalentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
               make.right.offset(-12);
               make.centerY.equalTo(freezeLabel);
           }];
           
           // 折合
           UILabel *equivalentValueLabel = [UILabel lableWithSuperView:self.contentView font:UIFont_Px(14) color:UIColor.tj_mainColor title:@"0.00000000" textAlignment:NSTextAlignmentLeft];
           [equivalentValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
               make.centerY.equalTo(freezeValueLabel);
               make.right.equalTo(equivalentLabel);
           }];
           //名称
        _currencyNameLabel = currencyNameLabel;
        //可用
           _availableValueLabel = availableValueLabel;
        //冻结
           _freezeValueLabel = freezeValueLabel;
        //折合
           _equivalentValueLabel = equivalentValueLabel;
           
      
    }
    return self;
}
    
-(void)setModel:(TJHomeModel *)model {
    _model = model;
    _currencyNameLabel.text = model.currency;
     _availableValueLabel.text =  [Tools reviseString:[NSString stringWithFormat:@"%@", model.fbBalance]];
     _freezeValueLabel.text = [Tools reviseString:[NSString stringWithFormat:@"%@", model.fbBlockedBalance]];
     _equivalentValueLabel.text = [Tools reviseString:[NSString stringWithFormat:@"%@", model.scaleFbCny]];
}


@end
